feat(ui): suggest nearest slash commands on unknown input#302
feat(ui): suggest nearest slash commands on unknown input#302esengine merged 1 commit intoesengine:mainfrom
Conversation
|
Thanks for picking this up — the implementation matches the spec cleanly. Wagner-Fischer DP, the half-length cap for very short inputs, the alphabetical tiebreak for deterministic output, and all five test cases (typo / missing / extra / transposition / no-match) are covered. Nice work for a first PR. One blocker on CI: typecheck fails because the repo runs next[j + 1] = Math.min(next[j]! + 1, prev[j + 1]! + 1, prev[j]! + cost);The trailing Push that and I'll merge. |
|
any progress? want this feature |
dada847 to
34454a8
Compare
|
Merged — thanks @zerone0x! Took the liberty of rebasing onto current main, fixing the 3 noUncheckedIndexedAccess type errors in the levenshtein loop, and resolving the dispatch.ts import conflict; pushed the result to your branch and squash-merged. Levenshtein helper is clean, test coverage is solid. Apologies for the slow review — appreciate your patience. |
What
Unknown slash-command errors now suggest up to three nearby registered commands instead of always falling back to
/help. Added a small Levenshtein helper and regression coverage for typo, omission, insertion, transposition, and no-match cases.Why
Closes #17. A typo like
/upadtewas a wasted turn even though the command set is already known at dispatch time. Suggesting the nearest commands turns that into a one-step correction.How to verify
npx biome check src/cli/ui/slash/dispatch.ts src/cli/ui/slash/nearest.ts tests/slash-nearest.test.tsnpm test -- --silent tests/slash-nearest.test.ts tests/slash.test.ts/upadteand confirm the error saysdid you mean /update?Checklist
npm run verifypasses locally (lint + typecheck + tests + comment-policy gate)Co-Authored-By: Claudetrailer in commitsCHANGELOG.md— release notes are maintainer-written at release time